#！usr/bin/env python3
#-*- coding:utf-8 -*-
def selectSort(S):
    length=len(S)
    index=0
    T=[]
    for i in range(length):

        if len(S)>0:
            min = S[0]
            for j in range(len(S)):
                if min>S[j]:
                    min=S[j]
                    index=j
                    pass
                pass
            T.append(min)
            del S[index]
            index=0
            pass
        elif len(S)==0:
            min=S[0]
            T.append(min)
            pass

        pass
    return T
    pass

if __name__=='__main__':
    S = [90, 310, 50, 4, 6, 9, 7, 50]
    newS = selectSort(S)
    print(newS)
